#include<stdio.h>
#include<string.h>
#include<unistd.h>

int main()
{
#define NUM 100
  char bar[NUM+1];
  memset(bar ,0 ,sizeof(bar));
  int i = 0;
  const char* label = "|/-\\";
  while(i<=100)
  {
    printf("[%-100s][%3d%%][%c]\r",bar,i,label[i%4]);
    usleep(50000);
    fflush(stdout);
    bar[i] = '=';
    i++;
  }
  printf("\n");
  return 0;
}
